package cn.tedu.day01.jnsdlfaq.dept.service.impl;

import cn.tedu.day01.jnsdlfaq.dept.mapper.SysDeptMapper;
import cn.tedu.day01.jnsdlfaq.dept.pojo.SysDept;
import cn.tedu.day01.jnsdlfaq.dept.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysDeptServiceImpl implements SysDeptService {

    @Autowired
    private SysDeptMapper sysDeptMapper;

    @Override
    public List<SysDept> selectAll() {
        return sysDeptMapper.selectList(null);
    }

    @Override
    public int addDept(SysDept dept) {
        return sysDeptMapper.insert(dept);
    }

    @Override
    public int updateDept(SysDept dept) {
        return sysDeptMapper.updateById(dept);
    }

    @Override
    public int deleteById(Integer id) {
        return sysDeptMapper.deleteById(id);
    }

    @Override
    public SysDept selectById(Integer id) {
        return sysDeptMapper.selectById(id);
    }
}
